//////////////////////////////////////////////////////////////////////////////////////////////////
//	File: MessagingSystem.h
//
//	Author: Justin Maza
//
//	Purpose: Handles the communication between game objects via messages
//			 
//////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once
#include "BaseMessage.h"

#include <queue>
using std::queue;

typedef void (*MESSENGER)(BaseMessage*);

class MessagingSystem
{
private:
	queue<BaseMessage*>		q_MsgQueue;
	MESSENGER				fpMsger;
	static MessagingSystem* pInstance;

	MessagingSystem(void);
	
	MessagingSystem(const MessagingSystem&);
	MessagingSystem& operator=(const MessagingSystem&);

	~MessagingSystem(void);

public:
	// Singleton memory management
	static MessagingSystem* GetInstance(void);
	static void DeleteInstance(void);			// ****DO NOT CALL UNTIL THEN END OF THE GAME'S SHUTDOWN!!!****

	void InitMessageSystem(MESSENGER fpMsg);

	void SendMsg(BaseMessage* pMsg);
	void ProcessMessages(void);
	void ClearMessages(void);
	void ShutdownMsgSystem(void);


};

